<template>
    <div>
        <div class="mui-table-view">															
            <h1>{{list.title}}</h1>
            <p class='mui-ellipsis'>
                <span>发表时间：{{list.add_time | dtaFormat}}</span>
                <span>点击：{{list.click}}次</span>
            </p>										                    							
		</div>
         <div class="content" v-html="list.content"></div>
         <comment-box :id="this.id"></comment-box>   
    </div>
</template>
<script>
    import axios from 'axios'
    import {Toast} from 'mint-ui'
    import comment from '../subcomponents/comment.vue'
    export default {
        data(){
            return {
                list:{},
                id:this.$route.params.id//将URL地址中传递过来的id值，挂载到data上，方便以后调用
            }
        },
        created() {
            this.getlistlist()
        },
        methods:{
            getlistlist(){
                axios({
                    method:'get',
                    url:`http://www.liulongbin.top:3005/api/getnew/${this.id}`
                }).then(res=>{
                    if(res.data.status===0){
                        this.list=res.data.message[0]
                    }else{
                        Toast("未找到数据")
                    }
                })
            }
        },
        components:{
            'comment-box':comment
        }

    }
</script>
<style lang="scss" >
    .mui-table-view{
        h1{font-size: 16px;
        color: red}
        .mui-ellipsis{
            display: flex;
            justify-content: space-between;
            color: blue;
        }
        
    }
    .content{
        img{
            width: 100%;
        }
    }
</style>
